

<!DOCTYPE html>
<html class="writer-html5" lang="zh" >
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>命令行工具 &mdash; Scrapy 2.3.0 文档</title>
  

  
  <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../_static/css/tooltipster.custom.css" type="text/css" />
  <link rel="stylesheet" href="../_static/css/tooltipster.bundle.min.css" type="text/css" />
  <link rel="stylesheet" href="../_static/css/tooltipster-sideTip-shadow.min.css" type="text/css" />
  <link rel="stylesheet" href="../_static/css/tooltipster-sideTip-punk.min.css" type="text/css" />
  <link rel="stylesheet" href="../_static/css/tooltipster-sideTip-noir.min.css" type="text/css" />
  <link rel="stylesheet" href="../_static/css/tooltipster-sideTip-light.min.css" type="text/css" />
  <link rel="stylesheet" href="../_static/css/tooltipster-sideTip-borderless.min.css" type="text/css" />
  <link rel="stylesheet" href="../_static/css/micromodal.css" type="text/css" />
  <link rel="stylesheet" href="../_static/css/sphinx_rtd_theme.css" type="text/css" />

  
  
  
  

  
  <!--[if lt IE 9]>
    <script src="../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
        <script src="../_static/jquery.js"></script>
        <script src="../_static/underscore.js"></script>
        <script src="../_static/doctools.js"></script>
        <script src="../_static/language_data.js"></script>
        <script src="../_static/js/hoverxref.js"></script>
        <script src="../_static/js/tooltipster.bundle.min.js"></script>
        <script src="../_static/js/micromodal.min.js"></script>
    
    <script type="text/javascript" src="../_static/js/theme.js"></script>

    
    <link rel="index" title="索引" href="../genindex.html" />
    <link rel="search" title="搜索" href="../search.html" />
    <link rel="next" title="蜘蛛" href="spiders.html" />
    <link rel="prev" title="实例" href="../intro/examples.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="../index.html" class="icon icon-home" alt="Documentation Home"> Scrapy
          

          
          </a>

          
            
            
              <div class="version">
                2.3
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption"><span class="caption-text">第一步</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../intro/overview.html">Scrapy一目了然</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/install.html">安装指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/tutorial.html">Scrapy 教程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../intro/examples.html">实例</a></li>
</ul>
<p class="caption"><span class="caption-text">基本概念</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">命令行工具</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#configuration-settings">配置设置</a></li>
<li class="toctree-l2"><a class="reference internal" href="#default-structure-of-scrapy-projects">报废项目的默认结构</a></li>
<li class="toctree-l2"><a class="reference internal" href="#sharing-the-root-directory-between-projects">在项目之间共享根目录</a></li>
<li class="toctree-l2"><a class="reference internal" href="#using-the-scrapy-tool">使用 <code class="docutils literal notranslate"><span class="pre">scrapy</span></code> 工具</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#creating-projects">创建项目</a></li>
<li class="toctree-l3"><a class="reference internal" href="#controlling-projects">控制性项目</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#available-tool-commands">可用工具命令</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#startproject">启动项目</a></li>
<li class="toctree-l3"><a class="reference internal" href="#genspider">基因蜘蛛</a></li>
<li class="toctree-l3"><a class="reference internal" href="#crawl">爬行</a></li>
<li class="toctree-l3"><a class="reference internal" href="#check">检查</a></li>
<li class="toctree-l3"><a class="reference internal" href="#list">列表</a></li>
<li class="toctree-l3"><a class="reference internal" href="#edit">编辑</a></li>
<li class="toctree-l3"><a class="reference internal" href="#fetch">取来</a></li>
<li class="toctree-l3"><a class="reference internal" href="#view">看法</a></li>
<li class="toctree-l3"><a class="reference internal" href="#shell">壳</a></li>
<li class="toctree-l3"><a class="reference internal" href="#parse">解析</a></li>
<li class="toctree-l3"><a class="reference internal" href="#settings">设置</a></li>
<li class="toctree-l3"><a class="reference internal" href="#runspider">运行蜘蛛</a></li>
<li class="toctree-l3"><a class="reference internal" href="#version">版本</a></li>
<li class="toctree-l3"><a class="reference internal" href="#bench">长凳</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="#custom-project-commands">自定义项目命令</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#commands-module">COMMANDS_MODULE</a></li>
<li class="toctree-l3"><a class="reference internal" href="#register-commands-via-setup-py-entry-points">通过setup.py入口点注册命令</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="spiders.html">蜘蛛</a></li>
<li class="toctree-l1"><a class="reference internal" href="selectors.html">选择器</a></li>
<li class="toctree-l1"><a class="reference internal" href="items.html">项目</a></li>
<li class="toctree-l1"><a class="reference internal" href="loaders.html">项目加载器</a></li>
<li class="toctree-l1"><a class="reference internal" href="shell.html">Scrapy shell</a></li>
<li class="toctree-l1"><a class="reference internal" href="item-pipeline.html">项目管道</a></li>
<li class="toctree-l1"><a class="reference internal" href="feed-exports.html">Feed 导出</a></li>
<li class="toctree-l1"><a class="reference internal" href="request-response.html">请求和响应</a></li>
<li class="toctree-l1"><a class="reference internal" href="link-extractors.html">链接提取器</a></li>
<li class="toctree-l1"><a class="reference internal" href="settings.html">设置</a></li>
<li class="toctree-l1"><a class="reference internal" href="exceptions.html">例外情况</a></li>
</ul>
<p class="caption"><span class="caption-text">内置服务</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="logging.html">登录</a></li>
<li class="toctree-l1"><a class="reference internal" href="stats.html">统计数据集合</a></li>
<li class="toctree-l1"><a class="reference internal" href="email.html">发送电子邮件</a></li>
<li class="toctree-l1"><a class="reference internal" href="telnetconsole.html">远程登录控制台</a></li>
<li class="toctree-l1"><a class="reference internal" href="webservice.html">Web服务</a></li>
</ul>
<p class="caption"><span class="caption-text">解决具体问题</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../faq.html">常见问题</a></li>
<li class="toctree-l1"><a class="reference internal" href="debug.html">调试spiders</a></li>
<li class="toctree-l1"><a class="reference internal" href="contracts.html">蜘蛛合约</a></li>
<li class="toctree-l1"><a class="reference internal" href="practices.html">常用做法</a></li>
<li class="toctree-l1"><a class="reference internal" href="broad-crawls.html">宽爬行</a></li>
<li class="toctree-l1"><a class="reference internal" href="developer-tools.html">使用浏览器的开发人员工具进行抓取</a></li>
<li class="toctree-l1"><a class="reference internal" href="dynamic-content.html">选择动态加载的内容</a></li>
<li class="toctree-l1"><a class="reference internal" href="leaks.html">调试内存泄漏</a></li>
<li class="toctree-l1"><a class="reference internal" href="media-pipeline.html">下载和处理文件和图像</a></li>
<li class="toctree-l1"><a class="reference internal" href="deploy.html">部署蜘蛛</a></li>
<li class="toctree-l1"><a class="reference internal" href="autothrottle.html">AutoThrottle 扩展</a></li>
<li class="toctree-l1"><a class="reference internal" href="benchmarking.html">标杆管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="jobs.html">作业：暂停和恢复爬行</a></li>
<li class="toctree-l1"><a class="reference internal" href="coroutines.html">协同程序</a></li>
<li class="toctree-l1"><a class="reference internal" href="asyncio.html">asyncio</a></li>
</ul>
<p class="caption"><span class="caption-text">扩展Scrapy</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="architecture.html">体系结构概述</a></li>
<li class="toctree-l1"><a class="reference internal" href="downloader-middleware.html">下载器中间件</a></li>
<li class="toctree-l1"><a class="reference internal" href="spider-middleware.html">蜘蛛中间件</a></li>
<li class="toctree-l1"><a class="reference internal" href="extensions.html">扩展</a></li>
<li class="toctree-l1"><a class="reference internal" href="api.html">核心API</a></li>
<li class="toctree-l1"><a class="reference internal" href="signals.html">信号</a></li>
<li class="toctree-l1"><a class="reference internal" href="exporters.html">条目导出器</a></li>
</ul>
<p class="caption"><span class="caption-text">其余所有</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../news.html">发行说明</a></li>
<li class="toctree-l1"><a class="reference internal" href="../contributing.html">为 Scrapy 贡献</a></li>
<li class="toctree-l1"><a class="reference internal" href="../versioning.html">版本控制和API稳定性</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../index.html">Scrapy</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../index.html" class="icon icon-home"></a> &raquo;</li>
        
      <li>命令行工具</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="command-line-tool">
<span id="topics-commands"></span><h1>命令行工具<a class="headerlink" href="#command-line-tool" title="永久链接至标题">¶</a></h1>
<p>碎屑通过控制 <code class="docutils literal notranslate"><span class="pre">scrapy</span></code> 命令行工具，这里称为“scrapy工具”，用于区分子命令，我们称之为“命令”或“scrapy命令”。</p>
<p>Scrapy工具提供了多个命令，用于多种目的，每个命令接受一组不同的参数和选项。</p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
     style="display:block; text-align:center;"
     data-ad-layout="in-article"
     data-ad-format="fluid"
     data-ad-client="ca-pub-1466963416408457"
     data-ad-slot="8850786025"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
<p>(The <code class="docutils literal notranslate"><span class="pre">scrapy</span> <span class="pre">deploy</span></code> 命令已在1.0中删除，以支持独立的 <code class="docutils literal notranslate"><span class="pre">scrapyd-deploy</span></code> . 见 <a class="reference external" href="https://scrapyd.readthedocs.io/en/latest/deploy.html">Deploying your project</a> ）</p>
<div class="section" id="configuration-settings">
<span id="topics-config-settings"></span><h2>配置设置<a class="headerlink" href="#configuration-settings" title="永久链接至标题">¶</a></h2>
<p>Scrapy将查找ini样式的配置参数 <code class="docutils literal notranslate"><span class="pre">scrapy.cfg</span></code> 标准位置的文件：</p>
<ol class="arabic simple">
<li><p><code class="docutils literal notranslate"><span class="pre">/etc/scrapy.cfg</span></code> 或 <code class="docutils literal notranslate"><span class="pre">c:\scrapy\scrapy.cfg</span></code> （全系统）</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">~/.config/scrapy.cfg</span></code>  (<code class="docutils literal notranslate"><span class="pre">$XDG_CONFIG_HOME</span></code> ） <code class="docutils literal notranslate"><span class="pre">~/.scrapy.cfg</span></code>  (<code class="docutils literal notranslate"><span class="pre">$HOME</span></code> ）用于全局（用户范围）设置，以及</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">scrapy.cfg</span></code> 在一个垃圾项目的根目录中（见下一节）。</p></li>
</ol>
<p>这些文件中的设置按列出的首选顺序合并：用户定义的值比系统范围的默认值具有更高的优先级，并且在定义时，项目范围的设置将覆盖所有其他设置。</p>
<p>Scrapy还可以理解并通过许多环境变量进行配置。目前有：</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">SCRAPY_SETTINGS_MODULE</span></code> （见 <a class="reference internal" href="settings.html#topics-settings-module-envvar"><span class="std std-ref">指定设置</span></a> ）</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">SCRAPY_PROJECT</span></code> （见 <a class="reference internal" href="#topics-project-envvar"><span class="std std-ref">在项目之间共享根目录</span></a> ）</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">SCRAPY_PYTHON_SHELL</span></code> （见 <a class="reference internal" href="shell.html#topics-shell"><span class="std std-ref">Scrapy shell</span></a> ）</p></li>
</ul>
</div>
<div class="section" id="default-structure-of-scrapy-projects">
<span id="topics-project-structure"></span><h2>报废项目的默认结构<a class="headerlink" href="#default-structure-of-scrapy-projects" title="永久链接至标题">¶</a></h2>
<p>在深入研究命令行工具及其子命令之前，让我们先了解一个零碎项目的目录结构。</p>
<p>尽管可以修改，但默认情况下，所有零碎项目都具有相同的文件结构，类似于：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>scrapy.cfg
myproject/
    __init__.py
    items.py
    middlewares.py
    pipelines.py
    settings.py
    spiders/
        __init__.py
        spider1.py
        spider2.py
        ...
</pre></div>
</div>
<p>目录 <code class="docutils literal notranslate"><span class="pre">scrapy.cfg</span></code> 文件驻留称为 <em>项目根目录</em> . 该文件包含定义项目设置的python模块的名称。下面是一个例子：</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[settings]</span>
<span class="na">default</span> <span class="o">=</span> <span class="s">myproject.settings</span>
</pre></div>
</div>
</div>
<div class="section" id="sharing-the-root-directory-between-projects">
<span id="topics-project-envvar"></span><h2>在项目之间共享根目录<a class="headerlink" href="#sharing-the-root-directory-between-projects" title="永久链接至标题">¶</a></h2>
<p>一个项目根目录，其中包含 <code class="docutils literal notranslate"><span class="pre">scrapy.cfg</span></code> ，可以由多个零碎项目共享，每个项目都有自己的设置模块。</p>
<p>在这种情况下，必须为下面的设置模块定义一个或多个别名 <code class="docutils literal notranslate"><span class="pre">[settings]</span></code> 在你 <code class="docutils literal notranslate"><span class="pre">scrapy.cfg</span></code> 文件：</p>
<div class="highlight-ini notranslate"><div class="highlight"><pre><span></span><span class="k">[settings]</span>
<span class="na">default</span> <span class="o">=</span> <span class="s">myproject1.settings</span>
<span class="na">project1</span> <span class="o">=</span> <span class="s">myproject1.settings</span>
<span class="na">project2</span> <span class="o">=</span> <span class="s">myproject2.settings</span>
</pre></div>
</div>
<p>默认情况下， <code class="docutils literal notranslate"><span class="pre">scrapy</span></code> 命令行工具将使用 <code class="docutils literal notranslate"><span class="pre">default</span></code> 设置。使用 <code class="docutils literal notranslate"><span class="pre">SCRAPY_PROJECT</span></code> 用于指定其他项目的环境变量 <code class="docutils literal notranslate"><span class="pre">scrapy</span></code> 使用：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ scrapy settings --get BOT_NAME
Project 1 Bot
$ export SCRAPY_PROJECT=project2
$ scrapy settings --get BOT_NAME
Project 2 Bot
</pre></div>
</div>
</div>
<div class="section" id="using-the-scrapy-tool">
<h2>使用 <code class="docutils literal notranslate"><span class="pre">scrapy</span></code> 工具<a class="headerlink" href="#using-the-scrapy-tool" title="永久链接至标题">¶</a></h2>
<p>您可以通过运行无参数的scrapy工具开始，它将打印一些用法帮助和可用的命令：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Scrapy X.Y - no active project

Usage:
  scrapy &lt;command&gt; [options] [args]

Available commands:
  crawl         Run a spider
  fetch         Fetch a URL using the Scrapy downloader
[...]
</pre></div>
</div>
<p>如果您在一个零碎的项目中，第一行将打印当前活动的项目。在本例中，它是从项目外部运行的。如果从项目内部运行，它将打印如下内容：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Scrapy X.Y - project: myproject

Usage:
  scrapy &lt;command&gt; [options] [args]

[...]
</pre></div>
</div>
<div class="section" id="creating-projects">
<h3>创建项目<a class="headerlink" href="#creating-projects" title="永久链接至标题">¶</a></h3>
<p>你通常会做的第一件事就是 <code class="docutils literal notranslate"><span class="pre">scrapy</span></code> 工具是创建零碎项目：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>scrapy startproject myproject [project_dir]
</pre></div>
</div>
<p>它将在 <code class="docutils literal notranslate"><span class="pre">project_dir</span></code> 目录。如果 <code class="docutils literal notranslate"><span class="pre">project_dir</span></code> 没有指定， <code class="docutils literal notranslate"><span class="pre">project_dir</span></code> 将与 <code class="docutils literal notranslate"><span class="pre">myproject</span></code> .</p>
<p>接下来，进入新的项目目录：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>cd project_dir
</pre></div>
</div>
<p>你已经准备好使用 <code class="docutils literal notranslate"><span class="pre">scrapy</span></code> 从那里管理和控制项目的命令。</p>
</div>
<div class="section" id="controlling-projects">
<h3>控制性项目<a class="headerlink" href="#controlling-projects" title="永久链接至标题">¶</a></h3>
<p>你使用 <code class="docutils literal notranslate"><span class="pre">scrapy</span></code> 从项目内部使用工具来控制和管理它们。</p>
<p>例如，要创建新的蜘蛛：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>scrapy genspider mydomain mydomain.com
</pre></div>
</div>
<p>一些下流的命令（比如 <a class="reference internal" href="#std-command-crawl"><code class="xref std std-command docutils literal notranslate"><span class="pre">crawl</span></code></a> ）必须从零碎的项目内部运行。见 <a class="reference internal" href="#topics-commands-ref"><span class="std std-ref">commands reference</span></a> 下面是关于必须从项目内部运行哪些命令的详细信息，而不是。</p>
<p>还要记住，当从内部项目运行某些命令时，它们的行为可能略有不同。例如，fetch命令将使用蜘蛛重写的行为（例如 <code class="docutils literal notranslate"><span class="pre">user_agent</span></code> 属性来重写用户代理）如果要获取的URL与某个特定的蜘蛛相关联。这是故意的，因为 <code class="docutils literal notranslate"><span class="pre">fetch</span></code> 命令用于检查蜘蛛如何下载页面。</p>
</div>
</div>
<div class="section" id="available-tool-commands">
<span id="topics-commands-ref"></span><h2>可用工具命令<a class="headerlink" href="#available-tool-commands" title="永久链接至标题">¶</a></h2>
<p>本节包含可用的内置命令列表，其中包含说明和一些用法示例。记住，您可以通过运行以下命令获取有关每个命令的更多信息：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>scrapy &lt;command&gt; -h
</pre></div>
</div>
<p>您可以使用以下命令查看所有可用命令：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>scrapy -h
</pre></div>
</div>
<p>有两种命令，一种是只从零碎项目（特定于项目的命令）内部工作的命令，另一种是不使用活动零碎项目（全局命令）的命令，尽管从项目内部运行时它们的行为可能略有不同（因为它们将使用项目覆盖设置）。</p>
<p>全局命令：</p>
<ul class="simple">
<li><p><a class="reference internal" href="#std-command-startproject"><code class="xref std std-command docutils literal notranslate"><span class="pre">startproject</span></code></a></p></li>
<li><p><a class="reference internal" href="#std-command-genspider"><code class="xref std std-command docutils literal notranslate"><span class="pre">genspider</span></code></a></p></li>
<li><p><a class="reference internal" href="#std-command-settings"><code class="xref std std-command docutils literal notranslate"><span class="pre">settings</span></code></a></p></li>
<li><p><a class="reference internal" href="#std-command-runspider"><code class="xref std std-command docutils literal notranslate"><span class="pre">runspider</span></code></a></p></li>
<li><p><a class="reference internal" href="#std-command-shell"><code class="xref std std-command docutils literal notranslate"><span class="pre">shell</span></code></a></p></li>
<li><p><a class="reference internal" href="#std-command-fetch"><code class="xref std std-command docutils literal notranslate"><span class="pre">fetch</span></code></a></p></li>
<li><p><a class="reference internal" href="#std-command-view"><code class="xref std std-command docutils literal notranslate"><span class="pre">view</span></code></a></p></li>
<li><p><a class="reference internal" href="#std-command-version"><code class="xref std std-command docutils literal notranslate"><span class="pre">version</span></code></a></p></li>
</ul>
<p>仅Project命令：</p>
<ul class="simple">
<li><p><a class="reference internal" href="#std-command-crawl"><code class="xref std std-command docutils literal notranslate"><span class="pre">crawl</span></code></a></p></li>
<li><p><a class="reference internal" href="#std-command-check"><code class="xref std std-command docutils literal notranslate"><span class="pre">check</span></code></a></p></li>
<li><p><a class="reference internal" href="#std-command-list"><code class="xref std std-command docutils literal notranslate"><span class="pre">list</span></code></a></p></li>
<li><p><a class="reference internal" href="#std-command-edit"><code class="xref std std-command docutils literal notranslate"><span class="pre">edit</span></code></a></p></li>
<li><p><a class="reference internal" href="#std-command-parse"><code class="xref std std-command docutils literal notranslate"><span class="pre">parse</span></code></a></p></li>
<li><p><a class="reference internal" href="#std-command-bench"><code class="xref std std-command docutils literal notranslate"><span class="pre">bench</span></code></a></p></li>
</ul>
<div class="section" id="startproject">
<span id="std-command-startproject"></span><span id="std:command-startproject"></span><h3>启动项目<a class="headerlink" href="#startproject" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li><p>Syntax： <code class="docutils literal notranslate"><span class="pre">scrapy</span> <span class="pre">startproject</span> <span class="pre">&lt;project_name&gt;</span> <span class="pre">[project_dir]</span></code></p></li>
<li><p>需要项目： <em>no</em></p></li>
</ul>
<p>创建一个名为 <code class="docutils literal notranslate"><span class="pre">project_name</span></code> 下 <code class="docutils literal notranslate"><span class="pre">project_dir</span></code> 目录。如果 <code class="docutils literal notranslate"><span class="pre">project_dir</span></code> 没有指定， <code class="docutils literal notranslate"><span class="pre">project_dir</span></code> 将与 <code class="docutils literal notranslate"><span class="pre">project_name</span></code> .</p>
<p>使用实例：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ scrapy startproject myproject
</pre></div>
</div>
</div>
<div class="section" id="genspider">
<span id="std-command-genspider"></span><span id="std:command-genspider"></span><h3>基因蜘蛛<a class="headerlink" href="#genspider" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li><p>Syntax： <code class="docutils literal notranslate"><span class="pre">scrapy</span> <span class="pre">genspider</span> <span class="pre">[-t</span> <span class="pre">template]</span> <span class="pre">&lt;name&gt;</span> <span class="pre">&lt;domain&gt;</span></code></p></li>
<li><p>需要项目： <em>no</em></p></li>
</ul>
<p>在当前文件夹或当前项目的 <code class="docutils literal notranslate"><span class="pre">spiders</span></code> 文件夹（如果从项目内部调用）。这个 <code class="docutils literal notranslate"><span class="pre">&lt;name&gt;</span></code> 参数设置为spider的 <code class="docutils literal notranslate"><span class="pre">name</span></code> ，同时 <code class="docutils literal notranslate"><span class="pre">&lt;domain&gt;</span></code> 用于生成 <code class="docutils literal notranslate"><span class="pre">allowed_domains</span></code> 和 <code class="docutils literal notranslate"><span class="pre">start_urls</span></code> 蜘蛛的属性。</p>
<p>使用实例：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ scrapy genspider -l
Available templates:
  basic
  crawl
  csvfeed
  xmlfeed

$ scrapy genspider example example.com
Created spider &#39;example&#39; using template &#39;basic&#39;

$ scrapy genspider -t crawl scrapyorg scrapy.org
Created spider &#39;scrapyorg&#39; using template &#39;crawl&#39;
</pre></div>
</div>
<p>这只是一个基于预先定义的模板创建spider的快捷命令，但肯定不是创建spider的唯一方法。您可以自己创建蜘蛛源代码文件，而不是使用这个命令。</p>
</div>
<div class="section" id="crawl">
<span id="std-command-crawl"></span><span id="std:command-crawl"></span><h3>爬行<a class="headerlink" href="#crawl" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li><p>Syntax： <code class="docutils literal notranslate"><span class="pre">scrapy</span> <span class="pre">crawl</span> <span class="pre">&lt;spider&gt;</span></code></p></li>
<li><p>需要项目： <em>yes</em></p></li>
</ul>
<p>开始用蜘蛛爬行。</p>
<p>用法示例：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ scrapy crawl myspider
[ ... myspider starts crawling ... ]
</pre></div>
</div>
</div>
<div class="section" id="check">
<span id="std-command-check"></span><span id="std:command-check"></span><h3>检查<a class="headerlink" href="#check" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li><p>Syntax： <code class="docutils literal notranslate"><span class="pre">scrapy</span> <span class="pre">check</span> <span class="pre">[-l]</span> <span class="pre">&lt;spider&gt;</span></code></p></li>
<li><p>需要项目： <em>yes</em></p></li>
</ul>
<p>运行合同检查。</p>
<p>用法示例：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ scrapy check -l
first_spider
  * parse
  * parse_item
second_spider
  * parse
  * parse_item

$ scrapy check
[FAILED] first_spider:parse_item
&gt;&gt;&gt; &#39;RetailPricex&#39; field is missing

[FAILED] first_spider:parse
&gt;&gt;&gt; Returned 92 requests, expected 0..4
</pre></div>
</div>
</div>
<div class="section" id="list">
<span id="std-command-list"></span><span id="std:command-list"></span><h3>列表<a class="headerlink" href="#list" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li><p>Syntax： <code class="docutils literal notranslate"><span class="pre">scrapy</span> <span class="pre">list</span></code></p></li>
<li><p>需要项目： <em>yes</em></p></li>
</ul>
<p>列出当前项目中所有可用的spider。每行输出一个蜘蛛。</p>
<p>使用实例：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ scrapy list
spider1
spider2
</pre></div>
</div>
</div>
<div class="section" id="edit">
<span id="std-command-edit"></span><span id="std:command-edit"></span><h3>编辑<a class="headerlink" href="#edit" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li><p>Syntax： <code class="docutils literal notranslate"><span class="pre">scrapy</span> <span class="pre">edit</span> <span class="pre">&lt;spider&gt;</span></code></p></li>
<li><p>需要项目： <em>yes</em></p></li>
</ul>
<p>使用中定义的编辑器编辑给定的蜘蛛 <code class="docutils literal notranslate"><span class="pre">EDITOR</span></code> 环境变量或（如果未设置） <a class="reference internal" href="settings.html#std-setting-EDITOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EDITOR</span></code></a> 设置。</p>
<p>这个命令仅作为最常见情况下的快捷方式提供，开发人员当然可以自由选择任何工具或IDE来编写和调试spider。</p>
<p>使用实例：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ scrapy edit spider1
</pre></div>
</div>
</div>
<div class="section" id="fetch">
<span id="std-command-fetch"></span><span id="std:command-fetch"></span><h3>取来<a class="headerlink" href="#fetch" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li><p>Syntax： <code class="docutils literal notranslate"><span class="pre">scrapy</span> <span class="pre">fetch</span> <span class="pre">&lt;url&gt;</span></code></p></li>
<li><p>需要项目： <em>no</em></p></li>
</ul>
<p>使用ScrapyDownloader下载给定的URL，并将内容写入标准输出。</p>
<p>这个命令的有趣之处在于它获取了蜘蛛如何下载它的页面。例如，如果蜘蛛 <code class="docutils literal notranslate"><span class="pre">USER_AGENT</span></code> 覆盖用户代理的属性，它将使用该属性。</p>
<p>所以这个命令可以用来“查看”蜘蛛如何获取特定的页面。</p>
<p>如果在项目之外使用，则不会应用特定的每蜘蛛行为，它只会使用默认的scrapy下载器设置。</p>
<p>支持的选项：</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">--spider=SPIDER</span></code> ：绕过Spider自动检测并强制使用特定Spider</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--headers</span></code> ：打印响应的HTTP头而不是响应的正文</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--no-redirect</span></code> ：不遵循HTTP 3xx重定向（默认为遵循它们）</p></li>
</ul>
<p>用法示例：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ scrapy fetch --nolog http://www.example.com/some/page.html
[ ... html content here ... ]

$ scrapy fetch --nolog --headers http://www.example.com/
{&#39;Accept-Ranges&#39;: [&#39;bytes&#39;],
 &#39;Age&#39;: [&#39;1263   &#39;],
 &#39;Connection&#39;: [&#39;close     &#39;],
 &#39;Content-Length&#39;: [&#39;596&#39;],
 &#39;Content-Type&#39;: [&#39;text/html; charset=UTF-8&#39;],
 &#39;Date&#39;: [&#39;Wed, 18 Aug 2010 23:59:46 GMT&#39;],
 &#39;Etag&#39;: [&#39;&quot;573c1-254-48c9c87349680&quot;&#39;],
 &#39;Last-Modified&#39;: [&#39;Fri, 30 Jul 2010 15:30:18 GMT&#39;],
 &#39;Server&#39;: [&#39;Apache/2.2.3 (CentOS)&#39;]}
</pre></div>
</div>
</div>
<div class="section" id="view">
<span id="std-command-view"></span><span id="std:command-view"></span><h3>看法<a class="headerlink" href="#view" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li><p>Syntax： <code class="docutils literal notranslate"><span class="pre">scrapy</span> <span class="pre">view</span> <span class="pre">&lt;url&gt;</span></code></p></li>
<li><p>需要项目： <em>no</em></p></li>
</ul>
<p>在浏览器中打开给定的URL，因为您的废蜘蛛会“看到”它。有时候蜘蛛看到的页面与普通用户不同，所以这可以用来检查蜘蛛“看到”什么，并确认它是你所期望的。</p>
<p>支持的选项：</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">--spider=SPIDER</span></code> ：绕过Spider自动检测并强制使用特定Spider</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--no-redirect</span></code> ：不遵循HTTP 3xx重定向（默认为遵循它们）</p></li>
</ul>
<p>使用实例：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ scrapy view http://www.example.com/some/page.html
[ ... browser starts ... ]
</pre></div>
</div>
</div>
<div class="section" id="shell">
<span id="std-command-shell"></span><span id="std:command-shell"></span><h3>壳<a class="headerlink" href="#shell" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li><p>Syntax： <code class="docutils literal notranslate"><span class="pre">scrapy</span> <span class="pre">shell</span> <span class="pre">[url]</span></code></p></li>
<li><p>需要项目： <em>no</em></p></li>
</ul>
<p>为给定的URL（如果给定）启动scrapy shell；如果没有给定URL，则为空。还支持Unix风格的本地文件路径，无论是相对于 <code class="docutils literal notranslate"><span class="pre">./</span></code> 或 <code class="docutils literal notranslate"><span class="pre">../</span></code> 前缀或绝对文件路径。见 <a class="reference internal" href="shell.html#topics-shell"><span class="std std-ref">Scrapy shell</span></a> 更多信息。</p>
<p>支持的选项：</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">--spider=SPIDER</span></code> ：绕过Spider自动检测并强制使用特定Spider</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">-c</span> <span class="pre">code</span></code> ：评估shell中的代码，打印结果并退出</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--no-redirect</span></code> ：不遵循HTTP 3xx重定向（默认为遵循它们）；这只影响在命令行上作为参数传递的URL；一旦进入shell， <code class="docutils literal notranslate"><span class="pre">fetch(url)</span></code> 默认情况下仍将遵循HTTP重定向。</p></li>
</ul>
<p>使用实例：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ scrapy shell http://www.example.com/some/page.html
[ ... scrapy shell starts ... ]

$ scrapy shell --nolog http://www.example.com/ -c &#39;(response.status, response.url)&#39;
(200, &#39;http://www.example.com/&#39;)

# shell follows HTTP redirects by default
$ scrapy shell --nolog http://httpbin.org/redirect-to?url=http%3A%2F%2Fexample.com%2F -c &#39;(response.status, response.url)&#39;
(200, &#39;http://example.com/&#39;)

# you can disable this with --no-redirect
# (only for the URL passed as command line argument)
$ scrapy shell --no-redirect --nolog http://httpbin.org/redirect-to?url=http%3A%2F%2Fexample.com%2F -c &#39;(response.status, response.url)&#39;
(302, &#39;http://httpbin.org/redirect-to?url=http%3A%2F%2Fexample.com%2F&#39;)
</pre></div>
</div>
</div>
<div class="section" id="parse">
<span id="std-command-parse"></span><span id="std:command-parse"></span><h3>解析<a class="headerlink" href="#parse" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li><p>Syntax： <code class="docutils literal notranslate"><span class="pre">scrapy</span> <span class="pre">parse</span> <span class="pre">&lt;url&gt;</span> <span class="pre">[options]</span></code></p></li>
<li><p>需要项目： <em>yes</em></p></li>
</ul>
<p>获取给定的URL，并使用处理它的spider，使用 <code class="docutils literal notranslate"><span class="pre">--callback</span></code> 选项，或 <code class="docutils literal notranslate"><span class="pre">parse</span></code> 如果没有给出。</p>
<p>支持的选项：</p>
<ul>
<li><p><code class="docutils literal notranslate"><span class="pre">--spider=SPIDER</span></code> ：绕过Spider自动检测并强制使用特定Spider</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--a</span> <span class="pre">NAME=VALUE</span></code> ：set spider参数（可以重复）</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--callback</span></code> 或 <code class="docutils literal notranslate"><span class="pre">-c</span></code> ：用作分析响应的回调的spider方法</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--meta</span></code> 或 <code class="docutils literal notranslate"><span class="pre">-m</span></code> ：将传递给回调请求的附加请求元。这必须是有效的JSON字符串。示例：--meta='“foo”：“bar”'</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--cbkwargs</span></code> ：将传递给回调的其他关键字参数。这必须是有效的JSON字符串。示例：--cbkwargs='“foo”：“bar”'</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--pipelines</span></code> ：通过管道处理项目</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--rules</span></code> 或 <code class="docutils literal notranslate"><span class="pre">-r</span></code> 使用 <a class="reference internal" href="spiders.html#scrapy.spiders.CrawlSpider" title="scrapy.spiders.CrawlSpider"><code class="xref py py-class docutils literal notranslate"><span class="pre">CrawlSpider</span></code></a> 发现用于解析响应的回调（即spider方法）的规则</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--noitems</span></code> ：不显示爬取的项目</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--nolinks</span></code> ：不显示提取的链接</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--nocolour</span></code> ：避免使用Pygments对输出着色</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--depth</span></code> 或 <code class="docutils literal notranslate"><span class="pre">-d</span></code> ：应递归执行请求的深度级别（默认值：1）</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--verbose</span></code> 或 <code class="docutils literal notranslate"><span class="pre">-v</span></code> ：显示每个深度级别的信息</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--output</span></code> 或 <code class="docutils literal notranslate"><span class="pre">-o</span></code> ：将刮取的项目转储到文件</p>
<div class="versionadded">
<p><span class="versionmodified added">2.3 新版功能.</span></p>
</div>
</li>
</ul>
<p>使用实例：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ scrapy parse http://www.example.com/ -c parse_item
[ ... scrapy log lines crawling example.com spider ... ]

&gt;&gt;&gt; STATUS DEPTH LEVEL 1 &lt;&lt;&lt;
# Scraped Items  ------------------------------------------------------------
[{&#39;name&#39;: &#39;Example item&#39;,
 &#39;category&#39;: &#39;Furniture&#39;,
 &#39;length&#39;: &#39;12 cm&#39;}]

# Requests  -----------------------------------------------------------------
[]
</pre></div>
</div>
</div>
<div class="section" id="settings">
<span id="std-command-settings"></span><span id="std:command-settings"></span><h3>设置<a class="headerlink" href="#settings" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li><p>Syntax： <code class="docutils literal notranslate"><span class="pre">scrapy</span> <span class="pre">settings</span> <span class="pre">[options]</span></code></p></li>
<li><p>需要项目： <em>no</em></p></li>
</ul>
<p>获取 Scrapy 设置的值。</p>
<p>如果在项目中使用，它将显示项目设置值，否则它将显示该设置的默认  Scrapy   值。</p>
<p>示例用法：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ scrapy settings --get BOT_NAME
scrapybot
$ scrapy settings --get DOWNLOAD_DELAY
0
</pre></div>
</div>
</div>
<div class="section" id="runspider">
<span id="std-command-runspider"></span><span id="std:command-runspider"></span><h3>运行蜘蛛<a class="headerlink" href="#runspider" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li><p>Syntax： <code class="docutils literal notranslate"><span class="pre">scrapy</span> <span class="pre">runspider</span> <span class="pre">&lt;spider_file.py&gt;</span></code></p></li>
<li><p>需要项目： <em>no</em></p></li>
</ul>
<p>运行一个包含在python文件中的spider，而不必创建一个项目。</p>
<p>示例用法：</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>$ scrapy runspider myspider.py
[ ... spider starts crawling ... ]
</pre></div>
</div>
</div>
<div class="section" id="version">
<span id="std-command-version"></span><span id="std:command-version"></span><h3>版本<a class="headerlink" href="#version" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li><p>Syntax： <code class="docutils literal notranslate"><span class="pre">scrapy</span> <span class="pre">version</span> <span class="pre">[-v]</span></code></p></li>
<li><p>需要项目： <em>no</em></p></li>
</ul>
<p>打印残缺版本。如果使用 <code class="docutils literal notranslate"><span class="pre">-v</span></code> 它还打印python、twisted和platform信息，这对bug报告很有用。</p>
</div>
<div class="section" id="bench">
<span id="std-command-bench"></span><span id="std:command-bench"></span><h3>长凳<a class="headerlink" href="#bench" title="永久链接至标题">¶</a></h3>
<ul class="simple">
<li><p>Syntax： <code class="docutils literal notranslate"><span class="pre">scrapy</span> <span class="pre">bench</span></code></p></li>
<li><p>需要项目： <em>no</em></p></li>
</ul>
<p>运行一个快速基准测试。 <a class="reference internal" href="benchmarking.html#benchmarking"><span class="std std-ref">标杆管理</span></a> .</p>
</div>
</div>
<div class="section" id="custom-project-commands">
<h2>自定义项目命令<a class="headerlink" href="#custom-project-commands" title="永久链接至标题">¶</a></h2>
<p>还可以使用 <a class="reference internal" href="#std-setting-COMMANDS_MODULE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">COMMANDS_MODULE</span></code></a> 设置。请参阅中的scrappy命令 <a class="reference external" href="https://github.com/scrapy/scrapy/tree/master/scrapy/commands">scrapy/commands</a> 有关如何实现命令的示例。</p>
<div class="section" id="commands-module">
<span id="std-setting-COMMANDS_MODULE"></span><span id="std:setting-COMMANDS_MODULE"></span><h3>COMMANDS_MODULE<a class="headerlink" href="#commands-module" title="永久链接至标题">¶</a></h3>
<p>违约： <code class="docutils literal notranslate"><span class="pre">''</span></code> （空字符串）</p>
<p>用于查找自定义 Scrapy 命令的模块。这用于为您的Scrapy项目添加自定义命令。</p>
<p>例子：</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">COMMANDS_MODULE</span> <span class="o">=</span> <span class="s1">&#39;mybot.commands&#39;</span>
</pre></div>
</div>
</div>
<div class="section" id="register-commands-via-setup-py-entry-points">
<h3>通过setup.py入口点注册命令<a class="headerlink" href="#register-commands-via-setup-py-entry-points" title="永久链接至标题">¶</a></h3>
<div class="admonition note">
<p class="admonition-title">注解</p>
<p>这是一个实验特性，小心使用。</p>
</div>
<p>还可以通过添加 <code class="docutils literal notranslate"><span class="pre">scrapy.commands</span></code> 库入口点中的节 <code class="docutils literal notranslate"><span class="pre">setup.py</span></code> 文件。</p>
<p>下面的示例添加了 <code class="docutils literal notranslate"><span class="pre">my_command</span></code> 命令：</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">setuptools</span> <span class="kn">import</span> <span class="n">setup</span><span class="p">,</span> <span class="n">find_packages</span>

<span class="n">setup</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;scrapy-mymodule&#39;</span><span class="p">,</span>
  <span class="n">entry_points</span><span class="o">=</span><span class="p">{</span>
    <span class="s1">&#39;scrapy.commands&#39;</span><span class="p">:</span> <span class="p">[</span>
      <span class="s1">&#39;my_command=my_scrapy_module.commands:MyCommand&#39;</span><span class="p">,</span>
    <span class="p">],</span>
  <span class="p">},</span>
 <span class="p">)</span>
</pre></div>
</div>
</div>
</div>
</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="spiders.html" class="btn btn-neutral float-right" title="蜘蛛" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="../intro/examples.html" class="btn btn-neutral float-left" title="实例" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        
        &copy; 版权所有 2008–2020, Scrapy developers
      <span class="lastupdated">
        最后更新于 10月 18, 2020.
      </span>

    </p>
  </div>
    
    
    
    Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a
    
    <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a>
    
    provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
  
 
<script type="text/javascript">
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","page","once","off","on"];analytics.factory=function(t){return function(){var e=Array.prototype.slice.call(arguments);e.unshift(t);analytics.push(e);return analytics}};for(var t=0;t<analytics.methods.length;t++){var e=analytics.methods[t];analytics[e]=analytics.factory(e)}analytics.load=function(t){var e=document.createElement("script");e.type="text/javascript";e.async=!0;e.src=("https:"===document.location.protocol?"https://":"http://")+"cdn.segment.com/analytics.js/v1/"+t+"/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n)};analytics.SNIPPET_VERSION="3.1.0";
analytics.load("8UDQfnf3cyFSTsM4YANnW5sXmgZVILbA");
analytics.page();
}}();

analytics.ready(function () {
    ga('require', 'linker');
    ga('linker:autoLink', ['scrapinghub.com', 'crawlera.com']);
});
</script>


</body>
</html>